function fn() {


    //声明数组
    let arr = []
    //对元素进行赋值
    arr[0] = 1
    arr[1] = 1
    //兔子算法
    for (let i = 2; i < 20; i++) {
        arr[i] = arr[i - 1] += arr[i - 2]
    }
    console.log(arr)

    //数组中存放对象
    let arrObject = []
    for (let i = 0; i < 20; i++) {
        //空对象
        let person = {}
        person.name = 'tom' + (i + 1)
        //[18,25]
        person.age = parseInt(Math.random() * (25 - 18 + 1)) + 18
        //把person放到数组中
        arrObject.push(person)
    }
    console.log(arrObject)
    for (let i = 0; i < arrObject.length; i++) {
        //获取数组中任意一个元素
        let object = arrObject[i]
        document.write('name=' + object.name + ',age' + object.age + '<br>')
    }
}
//把1-200之间的质数放到数组中，10个一行输出
let count = 0
for (let i = 2; i < 200; i++) {
    let j = 2;
    while (i % j != 0) {
        j++
    }
    if (i === j) {
        document.write(`${i} `)
        count++
        if (count % 10 === 0) {
            document.write('<br>')

        }

    }

}
//把1-200之间的质数放到数组中，10个一行输出
fn1()

function fn1() {
    let arr = []
    let count = 0
    //存数据
    for (let i = 2; i < 200; i++) {
        let j = 2
        while (i % j !== 0) {
            j++
        }
        if (i === j) {
            arr1.push(i)
        }
    }
    //取数据
    for (let i = 0, len = arr1.length; i < len; i++) {
        count++
        document.write(`<div class= "items">${arr[i]}</div>`)
        if (count % 10 === 0) {
            document.write('<br>')
        }
    }
}